//
//  WGBAlertView.h
//  WGBAlertViewDemo
//
//  Created by 王贵彬  on 2023/5/11.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/// 使用方法:
/// @code
/// WGBAlertView *alertView = [WGBAlertView alertView];
/// UIView *demoView = [[UIView alloc] initWithFrame:CGRectMake(100, 350, 200, 200)];
/// demoView.backgroundColor = [UIColor whiteColor];
/// demoView.userInteractionEnabled = YES;
/// alertView.touchDismiss = YES;
/// alertView.contentView = demoView;
/// [alertView show];
/// @endcode


typedef NS_ENUM(NSUInteger, WGBAlertViewAnimationType) {
    WGBAlertViewAnimationTypeDefault, //定格在原地不动无动画 只是显示/隐藏
    WGBAlertViewAnimationTypeFromBottomToTop, //从底部弹出
    WGBAlertViewAnimationTypeFromTopToBottom, //从顶部弹出
    WGBAlertViewAnimationTypeFromLeftToRight,//从左到右
    WGBAlertViewAnimationTypeFromRightToLeft,//从右到左
    WGBAlertViewAnimationTypeFromSmallToBig, //从小到大
    WGBAlertViewAnimationTypeFromBigToSmall  //从大到小
};


/// 通用弹窗组件
@interface WGBAlertView : UIView

/// 快捷创建
+ (WGBAlertView *)alertView;

/// 遮罩颜色 默认半透明 即黑色的0.4透明度
@property (nonatomic,strong) UIColor *maskColor;

/// 点击非弹窗内容区域调用dismiss 默认NO 
@property (nonatomic,assign) BOOL touchDismiss;
/// 是否使用弹性动画 默认YES
@property (nonatomic,assign) BOOL isUsingSpring;

/// 内容展示View 动画的操作对象 以及区分于容器, 需要动画的话 必须设置这个属性才会生效
/// 点击内容以外的区域结合touchDismiss 触发 dismiss (如果touchDismiss为NO 则无需设置)
@property (nonatomic,strong) UIView *contentView;

/// 动画类型需要在设置contentView之后设置才生效
@property (nonatomic,assign) WGBAlertViewAnimationType animationType;

/// 默认会添加到keyWindow上
- (void)show;
/// 将弹窗挂载到指定父视图上 hostView为空会默认添加到keyWindow
- (void)showAtHostView:(UIView *_Nullable)hostView;
/// 清除掉弹窗
- (void)dismiss;
/// dismiss之后
@property (nonatomic,copy) dispatch_block_t dismissDidEndBlock;

@end

NS_ASSUME_NONNULL_END
